package org.zhouhe.modules.website;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.zhouhe.base.BaseAction;
import org.zhouhe.modules.hotinfo.service.HotInfoService;
import org.zhouhe.page.PageUtil;
import org.zhouhe.vo.HotInfo;
import org.zhouhe.vo.HotInfoType;

public class HotinfoAction extends BaseAction {

	private static final long serialVersionUID = 896164905733014622L;
	private PageUtil pageUtil;
	private String pageTitle;
	private Integer t;//hotinfoTypeId
	private HotInfoType hotInfoType = new HotInfoType();
	private List<HotInfoType> hotInfoTypeList = new ArrayList<HotInfoType>();
	@Autowired
	private HotInfoService hotInfoService;

	public String hotinfoList(){
		hotInfoTypeList = hotInfoService.getHotInfoTypeList();
		hotInfoType.setHotInfoTypeId(t);
		if(hotInfoType.getHotInfoTypeId() == null){
			hotInfoType.setHotInfoTypeId(hotInfoTypeList.get(0).getHotInfoTypeId());
		}
		HotInfo hotInfo = new HotInfo();
		hotInfo.setHotInfoType(hotInfoType);
		pageUtil = hotInfoService.getHotInfoList(pageUtil, hotInfo);
		for(HotInfoType ht : hotInfoTypeList){
			if(ht.getHotInfoTypeId().equals(hotInfoType.getHotInfoTypeId())){
				this.setPageTitle(ht.getName());
			}
		}
		this.setPageTitle(this.getPageTitle() + " - 热点动态");
		return "hotinfoList";
	}
	
	
	public PageUtil getPageUtil() {
		return pageUtil;
	}

	public void setPageUtil(PageUtil pageUtil) {
		this.pageUtil = pageUtil;
	}

	public String getPageTitle() {
		return pageTitle;
	}

	public void setPageTitle(String pageTitle) {
		this.pageTitle = pageTitle;
	}


	public void setHotInfoType(HotInfoType hotInfoType) {
		this.hotInfoType = hotInfoType;
	}


	public HotInfoType getHotInfoType() {
		return hotInfoType;
	}


	public void setT(Integer t) {
		this.t = t;
	}


	public Integer getT() {
		return t;
	}


	public void setHotInfoTypeList(List<HotInfoType> hotInfoTypeList) {
		this.hotInfoTypeList = hotInfoTypeList;
	}


	public List<HotInfoType> getHotInfoTypeList() {
		return hotInfoTypeList;
	}
}
